﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MeTalker.Model
{
    public class MembersMod
    {
        public string UserTypeStr
        {
            get
            {
                if (!string.IsNullOrEmpty(UserType) && UserType.Equals("1"))
                    return "正式用户";
                return "试用";
            }
        }

        public int Days
        {
            get
            {
                return GetDay(ExpireDate, DateTime.Now);
            }
        }

        protected int GetDay(DateTime nowTime, DateTime endTime)
        {
            TimeSpan span = nowTime.Subtract(endTime);
            //return span.Days + 1;
            return span.Days;
        }
        public int AutoID { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 登录密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// QQ号码
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// Email地址
        /// </summary>
        public string Email { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        public string MobilePhone { get; set; }
        /// <summary>
        /// 用户名是否有效，可以用此字段来禁用账号
        /// </summary>
        public bool IsValid { get; set; }
        /// <summary>
        /// 用户名注册时间
        /// </summary>
        public DateTime AddDate { get; set; }
        /// <summary>
        /// 用户类型，0:试用用户，1：正式用户
        /// </summary>
        public string UserType { get; set; }
        /// <summary>
        /// 软件编号
        /// </summary>
        public string SoftID { get; set; }
        /// <summary>
        /// 软件名称
        /// </summary>
        public string SoftName { get; set; }
        /// <summary>
        /// 软件注册时间
        /// </summary>
        public DateTime RegistDate { get; set; }
        /// <summary>
        /// 软件过期时间
        /// </summary>
        public DateTime ExpireDate { get; set; }
        /// <summary>
        /// 硬盘序列号，用来防止一台机器注册多个用户名试用
        /// </summary>
        public string HDID { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Memo { get; set; }
        /// <summary>
        /// 是否已经登录的标识
        /// </summary>
        public bool LoginFlag { get; set; }

        /// <summary>
        /// 最后一次与服务器通信的时间
        /// </summary>
        public DateTime LatestOnline { get; set; }

        /// <summary>
        /// 授权时间
        /// </summary>
        //public DateTime LicenseDate { get; set; }


        /// <summary>
        /// 登录SessionId
        /// </summary>
        public string SessionId { get; set; }

        //public bool IsActivate { get; set; }
    }
}